package mysql

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	GoodsName  string  `gorm:"type:varchar(10);comment:商品名称"`
	GoodsPrice float64 `gorm:"type:decimal(10,2);comment:商品价格"`
	GoodsNum   int     `gorm:"type:int(10);comment:商品数量"`
	Status     int     `gorm:"type:int(1);comment:商品状态:0-审核通过，1-审核不通过"`
}

func (g *Goods) Create() error {
	return DB.Create(&g).Error
}

func (g *Goods) Update(GoodsId, status int64) error {
	return DB.Model(&g).Where("id=?", GoodsId).Update("status", status).Error
}
